package test0103.test02;

public class CompanyMS {
    public static void main(String[] args) {

        // (1)创建公司
        Company company = new Company("小米");

        // (2)创建部门和职位
        Department devDepartment = new Department(1, "开发部");
        Department testDepartment = new Department(2, "测试部");

        test0103.test02.Position juniorDev = new test0103.test02.Position(1, "初级开发");
        test0103.test02.Position midDev = new test0103.test02.Position(2, "中级开发");

        // (3)添加职位到部门
        devDepartment.addPosition(juniorDev);
        devDepartment.addPosition(midDev);

        // (4)添加部门到公司
        company.addDepartment(devDepartment);
        company.addDepartment(testDepartment);

        // (5)创建员工并添加到职位
        Employee zhangSan = new Employee(1, "张三", "男");
        Employee liSi = new Employee(2, "李四", "男");

        juniorDev.addEmployee(zhangSan);
        juniorDev.addEmployee(liSi);

        // (6)根据部门名查询一个部门对象
        Department x = company.getDepartmentByName("开发部");
        System.out.println(x);

        // (7)根据职位名查询一个职位对象
        Position y = company.getPositionByName("初级开发");
        System.out.println(y);

        // (8)根据员工名查询一个员工对象
        Employee z = company.getEmployeeByName("张三");
        System.out.println(z);

    }
}
